import { createStore } from 'vuex'

export default createStore({
  state: {
    sid: "",
    username: "",
    password: "",
    realName: "",
    position: "",
  },
  mutations: {
    updatesid(state, sid) {
      state.sid = sid;
      sessionStorage.setItem('sid', sid);
    },
    updateusername(state, username) {
      state.username = username;
      sessionStorage.setItem('username', username);
    },
    updatepassword(state, password) {
      state.password = password;
      sessionStorage.setItem('password', password);
    },
    updateName(state, realName) {
      state.realName = realName;
      sessionStorage.setItem('realName', realName);
    },
    updateposition(state, position) {
      state.position = position;
      sessionStorage.setItem('realName', position);
    }
  },
  getters: {
    getsid: (state) => state.sid,
    getrealName: (state) => state.realName,
    getusername: (state) => state.username,
    getpassword: (state) => state.password,
    getposition: (state) => state.position,
  },
  actions: {
  },
  modules: {
  }
})
